package cn.keniykey.mc.landterritory.toolkit;

import java.io.File;
import java.util.logging.Logger;

import cn.keniykey.mc.landterritory.LandTerritoryMain;

public final class DebugUtil {
	private static boolean debug;
	private static Logger logger;
	
	private DebugUtil() {}
	
	static {
		if(new File(LandTerritoryMain.getPlugin().getDataFolder(),"debug.text").exists()) {
			debug = true;
		}else {
			debug = LandTerritoryMain.getPlugin().getDescription().getVersion().endsWith("Debug");
		}
		if(debug) logger = LandTerritoryMain.getPlugin().getLogger(); 
	}
	
	public static void info(String mes) {
		if (debug) logger.warning("[Debug] " + mes);
		return;
	}
	public static boolean isDebug() {
		return debug;
	}
	public static void info(Exception ex) {
		if (debug) ex.printStackTrace();
		return;
	}
}